package com.azhuo.core.service.impl;


import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.azhuo.core.dao.UserDao;
import com.azhuo.core.pojo.User;
import com.azhuo.core.service.UserService;
import com.azhuo.utils.CreateId;

@Service
public class UserServiceImpl implements UserService {

	@Autowired
	private UserDao userDao;

	@Autowired
	private CreateId createId;
	
	/**
	 * 通过账号和密码查询用户
	 */
	@Override
	public User findUser(String usercode, String password) {
		return userDao.findUser(usercode, password);
	}

	/**
	 * 注册
	 */
	@Override
	public void regist(String usercode, String password) {
		User user = new User();

		user.setUser_id(createId.createId());
		user.setUser_code(usercode);
		user.setUser_password(password);
		user.setUser_state("1");
		System.out.println("user = " + user);
		userDao.insertUser(user);

	}

}
